<template>
	<view class="">
		<view class="content-top">
			<view class="nav">
				<view class="statusBar"  :style="{ 'height':statusBarHeight + 'px' }">	
				</view>
				<view class="naviBar"  :style="{ 'height':naviBarHeight + 'px' }">
					<view class="iconfont iconfanhui flex-1" @tap='goBack'></view>
					<view class="">
						老师介绍
					</view>
				</view>
			</view>
			<view class="content-teacher">
				<image :src="TeacherInfo.image" mode=""></image>
				<view class="teacherInfo">
					<view class="teacherInfo-l">
						{{TeacherInfo.name}}老师
					</view>
					<view class="teacherInfo-m">
						{{TeacherInfo.typeIntroduce}}
					</view>
					<view class="teacherInfo-n":key="i" v-for="(v,i) in TeacherInfo.tags">
						<view class="">
							{{v}}
						</view>
					</view>
				</view>
			</view>
		</view>
		<view class="page-section-spacing">
			<view class="scroll-view-item_H" v-for="(item,index) in tabList" @tap="changeTab(index)">
				<view class="animate__animated" hover-class="animate__rubberBand"
					:class="index == isActive ? 'active' :''">
					{{item.name}}
				</view>
				<view class="" :class="index == isActive ? 'line' :''"></view>
			</view>
		</view>
		<view class="Introuce" v-if="this.isActive===0">
			<scroll-view scroll-y="true" :style="{height: orderHeight+'px'}">
			<view class="Introuce-teacher">
				<view class="t-l">
					<image src="../../static/images/shoplist/jianjie@2x.png" mode=""></image>
					<view>教师介绍</view>
				</view>
				<view class="t-c">
					{{TeacherInfo.introduce}}
				</view>
				<view class="t-l">
					<image src="../../static/images/shoplist/jingyan@2x.png" mode=""></image>
					<view>授课经验</view>
				</view>
				<view class="t-c">
					<view class="exprenice" :key="i" v-for="(v,i) in TeacherInfo.experiences">
						<view class="">
						</view>
						<view class="">
							{{v}}
						</view>
					</view>
					
				</view>
			</view>
		   </scroll-view>
		</view>
		<view class="Introuce" v-if="this.isActive===1">
			<scroll-view scroll-y="true"  :style="{'height': orderHeight+'px'}">
			<view class="Introuce-teacher">
				<view class="t-l">
					<image src="../../static/images/shoplist/ketang@2x.png" mode=""></image>
					<view>全部课程</view>
				</view>
				<view class="" :key="i" v-for="(v,i) in TeacherInfo.classInfo">
					<view class="class" @click="jumpTo(v.shopId,v.classifyId)">
						<view class="">
							{{v.shopName}}
						</view>
						<text style="margin-left: 10rpx; font-size: 22rpx ;color: #999999;margin-top: 4rpx;" class="iconfont iconqianjin"></text>
					</view>
					<view class="class-content" @click="jumpTo1(v.id)">
						<view class="c-l">
							<image :src="v.image" mode=""></image>
						</view>
						<view class="c-r">
							<view class="r-t">
								<text>{{v.className}}</text>
								<text>已有{{v.number}}人报名</text>
							</view>
							<view class="r-b">
								开课时间：{{v.startTimes}}
							</view>
						</view>
						
					</view>
					<view class="line-l">	
					</view>
				</view>
				
				
			</view>
			</scroll-view>
		</view>
	</view>
</template>

<script>
	export default {
		data() {
			return {
				orderHeight:0,
				TeacherInfo:'',
				id:'',
				titleHeight: 0, //状态栏和导航栏的总高度
				statusBarHeight: 0 ,//状态栏高度
				naviBarHeight:0,//导航栏高度
				tabList: [{
					id: "1",
					name: '个人简介'
				}, {
					id: "2",
					name: '在授课程'
				}],
				isActive: 1,
			}
		},
		onLoad(option){
			console.log(option.id)
			this.id = option.id
			const res = uni.getSystemInfoSync()
			const system = res.platform
			this.statusBarHeight = res.statusBarHeight
			console.log(this.statusBarHeight)
			if (system === 'android') {
			this.titleHeight = (48 + this.statusBarHeight)
			} else if (system === 'ios') {
			this.titleHeight = (44 + this.statusBarHeight)
			}
			this.naviBarHeight = this.titleHeight - this.statusBarHeight
			console.log(this.naviBarHeight)
			this.getTeacherInfo()
			this.changeTab(0)
		},
		onReady() {
			let that = this;
			uni.getSystemInfo({ //调用uni-app接口获取屏幕高度
				success(res) { //成功回调函数
					that.orderHeight = res.windowHeight - uni.upx2px(660) //windoHeight为窗口高度，主要使用的是这个
				}
			})
		},
		methods:{
			jumpTo(a,b){
				uni.navigateTo({
					url: './product-activity?shopId='+a+'&classifyId='+b,
					animationType: 'pop-in',
					animationDuration: 200
				})
			},
			jumpTo1(id){
				uni.navigateTo({
					url: './product-activity-info?id='+id,
					animationType: 'pop-in',
					animationDuration: 200
				})
			},
			goBack(){
				uni.navigateBack({
					delta:1
				})
			},
			//点击事件改变swiper
			changeTab(active) {
				this.isActive = active
				if (active == 0) {
					this.payState = ''
					console.log(this.isActive)
				} else if (active == 1) {
					this.payState = 1
				} 
			},
			getTeacherInfo(){
				const data = {
					id:this.id
				}
				this.$api.getTeacherInfo(data).then(res => {
					if(res.data.success){
						console.log(res.data.dataMap)
						this.TeacherInfo = res.data.dataMap
					}
				})
			}
		}
	}
</script>

<style scoped>
	.flex-1{
		margin-left: 30rpx;
	}
	.line-l{
		width: 690rpx;
		height: 2rpx;
		background: #EEEEEE;
		margin: 20rpx auto;
	}
	.r-b{
		font-size: 22rpx;
		font-weight: 500;
		color: #999999;
		margin-left: 20rpx;
		margin-top: 40rpx;
	}
	.r-t{
		width: 490rpx;
		margin-top: 16rpx;
		height: 50rpx;
		margin-left: 20rpx;
		position: relative;
	}
	.r-t>text:nth-child(1){
		font-size: 28rpx;
		font-weight: bold;
		color: #222222;
		line-height: 50rpx;
	}
	.r-t>text:nth-child(2){
		font-size: 24rpx;
		font-weight: 500;
		color: #FF5551;
		line-height: 50rpx;
		position: absolute;
		top: -4rpx;
		right: 10rpx;
	}
	.class-content{
		display: flex;
	}
	.c-l image{
		width: 180rpx;
		height: 120rpx;
		border-radius: 8rpx;
		margin-left: 30rpx;
		margin-top: 20rpx;
	}
	.class{
		display: flex;
		align-items: center;
	}
	.class view{
		font-size: 29rpx;
		font-weight: 500;
		color: #666666;
		margin-left: 32rpx;
	}
	.exprenice{
		display: flex;
		align-items: center;
		margin-bottom: 17rpx;
		color:rgba(102, 102, 102, 1);
	}
	.exprenice view:nth-child(1){
		width: 10rpx;
		height: 10rpx;
		background: #FF7E51;
		border-radius: 50%;
		margin-left: 25rpx;
	}
	.exprenice view:nth-child(2){
		font-size: 26rpx;
		font-weight: 500;
		color: #666666;
		line-height: 36rpx;
		margin-left: 17rpx;
	}
	.t-c{
		width: 629rpx;
		margin: 20rpx auto;
		line-height: 36rpx;
		font-size: 26rpx;
		font-weight: 500;
		color: #666666;
	}
	.Introuce-teacher{
		/* border:1px solid red; */
		padding-top: 50rpx;
		padding-bottom:50rpx ;
	}
	.t-l {
		display: flex;
		align-items: center;
		margin-bottom: 10rpx;
	}
	.t-l image{
		width: 36rpx;
		height: 36rpx;
		margin-left: 30rpx;
	}
	.t-l view{
		font-size: 32rpx;
		font-weight: bold;
		color: #333333;
		margin-left: 17rpx;
	}
	.scroll-view-item_H>view {
		font-size: 32rpx;
		/* border: 1px solid red; */
		line-height: 100rpx;
	
	}
	
	.page-section-spacing {
		background-color: #ffffff;
		display: flex;
		justify-content: space-around;
		margin-top: -70rpx;
		border-radius: 60rpx 60rpx 0rpx 0rpx;
	}
	
	.line {
		height: 6rpx;
		background-color: #FF5551;
		width: 50%;
		margin: auto;
		border-radius: 50rpx;
		margin-top: -5rpx;
	}
	
	.line-gray {
		height: 1rpx;
		width: 660rpx;
		background-color: #f0f0f0;
		margin: auto;
		border-radius: 24rpx;
		z-index: 99;
	}
	
	.active {
		color: #a7a7a7;
	}
	
	.scroll-view-item_H {
		display: inline-block;
		width: 150rpx;
		height: 75rpx;
		text-align: center;
		font-size: 34rpx;
	}
	.content-top{
		height: 650rpx;
		background: url(../../static/images/bg.jpg) repeat fixed center;
	}
	.naviBar{
		display: flex;
	}
	.naviBar view:nth-child(1){
		font-size: 34rpx;
		font-family: PingFang SC;
		font-weight: bold;
		color: #FFFFFF;
		line-height: 90rpx;
	}
	.naviBar view:nth-child(2){
		margin-right: 320rpx;
		font-size: 34rpx;
		font-family: PingFang SC;
		font-weight: bold;
		color: #FFFFFF;
		line-height: 90rpx;
	}
	.content-teacher{
		display: flex;
		
	}
	.content-teacher image{
		width: 260rpx;
		height: 320rpx;
		border-radius: 30rpx;
		margin-left: 50rpx;
		margin-top: 30rpx;
	}
	.teacherInfo{
		margin-left: 60rpx;
		margin-top: 40rpx;
	}
	.teacherInfo-l{
		font-size: 48rpx;
		font-family: PingFang SC;
		font-weight: bold;
		color: #FFFFFF;
	}
	.teacherInfo-m{
		font-size: 30rpx;
		font-family: PingFang SC;
		font-weight: 500;
		color: #FFFFFF;
	}
	.teacherInfo-n{
		display: inline-block;
		margin-top: 10rpx;

	}
	.teacherInfo-n view{
		display: inline-block;
		margin-bottom: 16rpx;
		min-width: 140rpx;
		height: 60rpx;
		background: #FFFFFF;
		opacity: 0.2;
		border-radius: 8rpx;
		text-align: center;
		line-height: 60rpx;
		font-size: 26rpx;
		font-weight: 500;
		margin-right: 10rpx;
		/* color: #FFFFFF; */
	}
</style>
